package com.quanxiaoha.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.quanxiaoha.weblog.common.config.InsertBatchMapper;
import com.quanxiaoha.weblog.common.domain.dos.ArticleTagRelDO;

import java.util.List;

public interface ArticleTagRelMapper extends InsertBatchMapper<ArticleTagRelDO> {

    /**
     * 根据文章id删除文章-标签记录
     *
     * @param articleId
     */
    default void delByArticleId(Long articleId) {
        this.delete(new LambdaQueryWrapper<ArticleTagRelDO>().eq(ArticleTagRelDO::getArticleId, articleId));
    }


    default List<ArticleTagRelDO> getByArticleId(Long articleId) {

        return this.selectList(new LambdaQueryWrapper<ArticleTagRelDO>().eq(ArticleTagRelDO::getArticleId, articleId));
    }

}